<template>
  <view class="qr-code-container">
    <!-- 关闭按钮 -->
    <view class="close-btn" @click="closePage">×</view>
    <!-- 标题 -->
    <view class="title">领取二维码</view>
    <!-- 更多操作按钮 -->
    <view class="more-btn">...</view>

    <!-- 温馨提示区域 -->
    <view class="note">
      <text>温馨提示:</text>
      <text>Please Note:</text>
      <text>选择线下扫码领取，则不能缺货登记。选择线上缺货登记，则不能线下扫码领取。</text>
      <text>On-site pickup and backorder registration are mutually exclusive options.</text>
    </view>

    <!-- 按钮区域：垂直排列 -->
    <view class="btn-group">
      <button class="cancel-btn" @click="handleCancel">取消Cancel</button>
      <button class="confirm-btn" @click="handleConfirm">确认Confirm</button>
    </view>

    <!-- 技术支持文字 -->
    <view class="tech-support">成电芯伙伴提供技术支持</view>
  </view>
</template>

<script>
export default {
  methods: {
    // 关闭当前页返回第一个页面
    closePage() {
      uni.navigateBack({
        delta: 1,  // 返回上一页，即第一个页面
        success: () => {
          console.log('返回di12页面成功');
        },
        fail: (err) => {
          console.error('返回di12页面失败:', err);
        }
      });
    },

    // 取消按钮 - 返回第一个页面（修改页面）
    handleCancel() {
      uni.showToast({
        title: '已取消，返回修改页面',
        icon: 'none',
        duration: 1500
      });

      // 显示提示后返回
      setTimeout(() => {
        this.closePage();
      }, 1500);
    },

    // 确认按钮逻辑
    handleConfirm() {
      console.log('确认操作执行');
      uni.showToast({
        title: '确认成功',
        icon: 'success',
        duration: 1500
      });

      // 确认后返回
      setTimeout(() => {
        this.closePage();
      }, 1500);
    }
  }
};
</script>

<style scoped>
/* 样式保持不变 */
.qr-code-container {
  padding: 20rpx;
  position: relative;
  min-height: 100vh;
  box-sizing: border-box;
  background-color: #f9f9f9;
}

.close-btn {
  position: absolute;
  top: 20rpx;
  left: 20rpx;
  font-size: 40rpx;
  cursor: pointer;
  z-index: 10;
}

.title {
  text-align: center;
  font-size: 36rpx;
  font-weight: bold;
  margin: 20rpx 0 40rpx;
  padding-top: 20rpx;
}

.more-btn {
  position: absolute;
  top: 20rpx;
  right: 20rpx;
  font-size: 40rpx;
  cursor: pointer;
  z-index: 10;
}

.note {
  background-color: #fff8e1;
  padding: 20rpx;
  margin-bottom: 60rpx;
  border-radius: 10rpx;
  font-size: 24rpx;
  color: #666;
  line-height: 1.5;
}

.btn-group {
  display: flex;
  flex-direction: column;
  gap: 25rpx;
  margin-bottom: 40rpx;
}

.cancel-btn {
  width: 100%;
  padding: 25rpx;
  background-color: #f5f5f5;
  color: #333;
  border: 1px solid #ddd;
  border-radius: 10rpx;
  font-size: 32rpx;
  cursor: pointer;
}

.confirm-btn {
  width: 100%;
  padding: 25rpx;
  background-color: #2196f3;
  color: #fff;
  border: none;
  border-radius: 10rpx;
  font-size: 32rpx;
  cursor: pointer;
}

.tech-support {
  text-align: center;
  font-size: 26rpx;
  color: #666;
  margin-top: 40rpx;
}
</style>